package chp08.ext;

import java.util.Scanner;

public class Ext4 {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int[][] map = {
                {0,0,0,0,0},
                {0,0,0,0,0},
                {0,0,0,0,0},
                {0,0,0,0,0},
                {0,0,0,0,0}
        };

        int x = 2;
        int y = 3;

        while(true) {
            //设置英雄
            map[y][x] = 1;

            for (int i = 0; i < map.length; i++) {
                for (int j = 0; j < map[0].length; j++) {
//                System.out.print(map[i][j]+"\t");
                    switch (map[i][j]) {
                        case 0:
                            System.out.print("_\t");
                            break;
                        case 1:
                            System.out.print("@\t");
                            break;
                    }
                }
                System.out.println();
            }
            //把原来英雄位置重置为0
            map[y][x] = 0;
            System.out.print("请输入方向 w a s d:");
            String choose = input.next();
            switch (choose){
                case "w":
                    y--;
                    break;
                case "s":
                    y++;
                    break;
            }
        }
    }
}
